define('app/demo/audit/auditDemoAdd', function (require, exports, module) {
    'use strict';
    var $=require('jquery'),
	    Widget = require('arale-widget/1.2.0/widget'),
	    Dialog = require("optDialog/src/dialog"),
	    AjaxController = require('opt-ajax/1.0.0/index');
    require("jsviews/jsrender.min");
    require("jsviews/jsviews.min");
    require("bootstrap-paginator/bootstrap-paginator.min");
    require("app/util/jsviews-ext");

    require("jquery-validation/1.15.1/jquery.validate");
	require("app/util/aiopt-validate-ext");

    var SendMessageUtil = require("app/util/sendMessage");

    //实例化AJAX控制处理对象
    var ajaxController = new AjaxController();
    //定义页面组件类
    var catAddPager = Widget.extend({
    	
    	Implements:SendMessageUtil,
    	//属性，使用时由类的构造函数传入
    	attrs: {
    		clickId:""
    	},
    	Statics: {
    		DEFAULT_PAGE_SIZE: 10
    	},
    	//事件代理
    	events: {
			"click #submitAddBtn":"_submitCatList"
            },
    	//重写父类
    	setup: function () {
			catAddPager.superclass.setup.call(this);
    	},
		//提交添加
		_submitCatList:function() {
			var productName = $('#productName0').val();
			var productPrice = $("#productPrice0").val();
			ajaxController.ajax({
				type: "post",
				processing: true,
				message: "保存中，请等待...",
				url: _base + "/auditdemo/save",
				data: {'productName': productName, 'productPrice': productPrice},
				success: function (data) {
					if("1"===data.statusCode){
						Dialog({
							content:"提交成功",
							icon:'success',
							okValue: '确 定',
							title: '提示',
							ok:function(){
								window.location.href=_base+"/auditdemo/toAdd";
							}
						}).show();
					}
				}
			});
		}
    });
    
    module.exports = catAddPager;
});

